<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="./vue.js"></script>
  <style>
    .active {
      color: red;
    }
  </style>
</head>
<!-- 让谁被点击谁就是红色 -->

<body>
  <div id="app">
    <ul>
      <li v-for="(i,index) in movies" :class="{active:currentIndex===index}" @click="liClick(index)">
        {{i}}
      </li>
    </ul>
  </div>

  <script>
    var vm = new Vue({
      el: '#app',
      data: {
        movies: ['123', '233', 'asdf', 'qwee'],
        currentIndex: 0
      },
      methods: {
        liClick(index) {
          this.currentIndex = index;
        }
      }
    })
  </script>
</body>

</html>